{template header_admin}
<div id="pagecontainer">
	<div class="toolbar">
    	<div class="f-right">
        	<a class="baritem" href="/?m=$G[m]&c=$G[c]&a=showlist">返回列表</a>
        </div>
    	<strong>添加分公司</strong>
    </div>
	<div class="area">
        <form method="post" id="shopForm" action="">
        <input type="hidden" name="formsubmit" value="yes" />
        <input type="hidden" name="formhash" value="{FORMHASH}">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="formtable">
        <tr>
          <td width="70">公司名称</td>
          <td><input type="text" class="input-text w300" maxlength="20"  name="shopnew[shopname]" value="$shop[shopname]" id="shopname"></td>
          <td width="70">联系电话</td>
          <td><input type="text" class="input-text" maxlength="11"  name="shopnew[tel]" value="$shop[tel]"></td>
          <td rowspan="4" width="160">
            <input type="hidden" id="shopLogo" name="shopnew[logo]" value="$shop[logo]">
            <div class="post-image-box" title="点击更换图片">
            <img src="{echo image($shop[logo])}" onclick="setImage(this,'#shopLogo')"></div>
          </td>
        </tr>
        <tr>
            <td>所在区域</td>
            <td colspan="3">
            	<select class="input-select dist select" id="province" name="shopnew[province]">
                    <option value="">请选择</option>
                </select>
                <select class="input-select dist select" id="city" name="shopnew[city]">
                    <option value="">请选择</option>
                </select>
                <select class="input-select dist select" id="county" name="shopnew[county]">
                    <option value="">请选择</option>
                </select>
            </td>
          
         </tr>
         <tr>
              <td>详细地址</td>
              <td colspan="3"><input type="text" class="input-text w500" name="shopnew[address]" value="$shop[address]"></td>
          </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="formtable">
        <tr>
          <td width="70">主营项目</td>
          <td><textarea style="width:100%;" name="shopnew[summary]">$shop[summary]</textarea></td>
          <td width="200"><input type="submit" class="submit button-publish f-right" value="{if $G[a]=='edit'}更新{else}提交{/if}" id="publishButton"></td>
        </tr>
      </table>
      {eval $editorname='description';}
      {eval $editorcontent=$description[description];}
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="formtable">
        <tr>
        	<td width="70">详细介绍</td>
          	<td><div style="box-sizing:border-box">{template editor}</div></td>
        </tr>
      </table>
      </form>
    </div>
</div>
<script type="text/javascript">
DSXCMS.showDistrict(0, '#province', '$shop[province]', '选择省份');
$("#province").change(function(e) {
	var fid = parseInt($(this).find(":selected").attr("idvalue"));
    if(fid) DSXCMS.showDistrict(fid, '#city', '$shop[city]', '选择城市');
});
$("#city").change(function(e) {
	var fid = parseInt($(this).find(":selected").attr("idvalue"));
    if(fid) {
		DSXCMS.showDistrict(fid, '#county', '$shop[county]', '选择区县');
	}
});
$("#shopForm").submit(function(e) {
    var shopname = $.trim($("#shopname").val());
	if(shopname.length > 1) {
		return true;
	}else {
		DSXUI.error('公司名称不能为空');
		return false;
	}
});
function setImage(o,input){
	DSXUI.showImgUploadWindow({},function(c){
		if(c.errno == 0){
			$(o).attr('src', c.data.imageurl);
			$(input).val(c.data.image);
		}
	});
}
</script>
</div>
{template footer_admin}